<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商城后台管理系统 - 订单管理</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        :root {
            --primary: #3498db;
            --secondary: #2c3e50;
            --success: #2ecc71;
            --warning: #f39c12;
            --danger: #e74c3c;
            --dark: #1a1f2a;
            --light: #f8f9fa;
            --card-bg: #252d3a;
            --sidebar-width: 250px;
            --header-height: 70px;
        }

        body {
            background-color: #1a1f2a;
            color: #e9ecef;
            min-height: 100vh;
        }

        #app {
            display: flex;
            min-height: 100vh;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: var(--sidebar-width);
            background-color: var(--dark);
            height: 100vh;
            position: fixed;
            padding-top: 20px;
            box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
            z-index: 100;
        }

        .logo {
            padding: 20px;
            text-align: center;
            border-bottom: 1px solid #2c3e50;
            margin-bottom: 20px;
        }

        .logo h1 {
            font-size: 1.5rem;
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .logo i {
            color: var(--primary);
        }

        .nav-links {
            list-style: none;
            padding: 0 20px;
        }

        .nav-links li {
            margin-bottom: 10px;
        }

        .nav-links a {
            display: flex;
            align-items: center;
            padding: 12px 15px;
            color: #b0b3b8;
            text-decoration: none;
            border-radius: 5px;
            transition: all 0.3s ease;
            gap: 12px;
        }

        .nav-links a:hover,
        .nav-links a.active {
            background-color: var(--card-bg);
            color: #fff;
        }

        .nav-links a i {
            width: 25px;
            text-align: center;
        }

        /* 主内容区样式 */
        .main-content {
            flex: 1;
            margin-left: var(--sidebar-width);
            padding: 20px;
        }

        /* 顶部导航栏 */
        .topbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: var(--card-bg);
            padding: 15px 30px;
            border-radius: 10px;
            margin-bottom: 30px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .search-box {
            display: flex;
            align-items: center;
            background: #1e2430;
            padding: 8px 15px;
            border-radius: 30px;
            width: 300px;
        }

        .search-box input {
            background: transparent;
            border: none;
            color: white;
            padding: 8px;
            width: 100%;
            outline: none;
        }

        .user-actions {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .notification,
        .user-profile {
            position: relative;
            cursor: pointer;
        }

        .notification i {
            font-size: 1.2rem;
        }

        .badge {
            position: absolute;
            top: -5px;
            right: -5px;
            background: var(--danger);
            color: white;
            border-radius: 50%;
            width: 18px;
            height: 18px;
            font-size: 0.7rem;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .user-profile img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }

        /* 订单管理区域 */
        .orders-container {
            background: var(--card-bg);
            border-radius: 10px;
            padding: 25px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .orders-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .orders-title {
            font-size: 1.2rem;
            font-weight: 600;
        }

        .orders-actions {
            display: flex;
            gap: 15px;
        }

        .filter-section {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-bottom: 20px;
            background: #1e2430;
            padding: 15px;
            border-radius: 8px;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
            min-width: 180px;
        }

        .filter-label {
            font-size: 0.85rem;
            color: #b0b3b8;
            margin-bottom: 5px;
        }

        .filter-select, .filter-input {
            background: #2c3e50;
            border: 1px solid #34495e;
            border-radius: 5px;
            padding: 8px 12px;
            color: white;
            outline: none;
        }

        .filter-select:focus, .filter-input:focus {
            border-color: var(--primary);
        }

        .orders-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        .orders-table th {
            background-color: #2c3e50;
            padding: 12px 15px;
            text-align: left;
            font-weight: 600;
            color: #b0b3b8;
            border-bottom: 2px solid #34495e;
        }

        .orders-table td {
            padding: 15px;
            border-bottom: 1px solid #34495e;
            color: #e9ecef;
        }

        .orders-table tr:hover {
            background-color: rgba(52, 73, 94, 0.2);
        }

        .order-id {
            color: var(--primary);
            font-weight: 500;
        }

        .status-badge {
            display: inline-block;
            padding: 5px 10px;
            border-radius: 15px;
            font-size: 0.85rem;
            font-weight: 500;
        }

        .status-pending {
            background: rgba(243, 156, 18, 0.2);
            color: var(--warning);
        }

        .status-paid {
            background: rgba(52, 152, 219, 0.2);
            color: var(--primary);
        }

        .status-shipped {
            background: rgba(46, 204, 113, 0.2);
            color: var(--success);
        }

        .status-completed {
            background: rgba(149, 165, 166, 0.2);
            color: #b0b3b8;
        }

        .status-cancelled {
            background: rgba(231, 76, 60, 0.2);
            color: var(--danger);
        }

        .action-buttons {
            display: flex;
            gap: 8px;
        }

        .btn {
            padding: 6px 12px;
            border-radius: 4px;
            border: none;
            cursor: pointer;
            font-size: 0.85rem;
            transition: all 0.2s;
        }

        .btn-view {
            background: rgba(52, 152, 219, 0.2);
            color: var(--primary);
        }

        .btn-edit {
            background: rgba(46, 204, 113, 0.2);
            color: var(--success);
        }

        .btn-cancel {
            background: rgba(231, 76, 60, 0.2);
            color: var(--danger);
        }

        .btn:hover {
            opacity: 0.8;
            transform: translateY(-2px);
        }

        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 25px;
            gap: 8px;
        }

        .page-btn {
            padding: 8px 15px;
            background: #2c3e50;
            color: #b0b3b8;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .page-btn.active {
            background: var(--primary);
            color: white;
        }

        .page-btn:hover:not(.active) {
            background: #34495e;
        }

        .stats-card {
            background: var(--card-bg);
            border-radius: 10px;
            padding: 20px;
            display: flex;
            flex-direction: column;
            margin-bottom: 20px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .stats-row {
            display: flex;
            gap: 20px;
            margin-bottom: 20px;
        }

        .stat-item {
            flex: 1;
            background: #1e2430;
            border-radius: 8px;
            padding: 15px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .stat-info {
            display: flex;
            flex-direction: column;
        }

        .stat-label {
            font-size: 0.9rem;
            color: #b0b3b8;
            margin-bottom: 5px;
        }

        .stat-value {
            font-size: 1.5rem;
            font-weight: 700;
        }

        .stat-icon {
            width: 50px;
            height: 50px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
        }

        .icon-pending {
            background: rgba(243, 156, 18, 0.2);
            color: var(--warning);
        }

        .icon-paid {
            background: rgba(52, 152, 219, 0.2);
            color: var(--primary);
        }

        .icon-shipped {
            background: rgba(46, 204, 113, 0.2);
            color: var(--success);
        }

        .icon-completed {
            background: rgba(149, 165, 166, 0.2);
            color: #b0b3b8;
        }

        /* 响应式调整 */
        @media (max-width: 992px) {
            .orders-table {
                display: block;
                overflow-x: auto;
            }
            
            .stats-row {
                flex-direction: column;
            }
        }

        @media (max-width: 768px) {
            .sidebar {
                width: 70px;
            }

            .logo h1 span,
            .nav-links a span {
                display: none;
            }

            .logo h1 {
                justify-content: center;
            }

            .nav-links a {
                justify-content: center;
            }

            .main-content {
                margin-left: 70px;
            }

            .search-box {
                width: 200px;
            }
            
            .filter-section {
                flex-direction: column;
            }
        }

        @media (max-width: 576px) {
            .orders-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 15px;
            }
            
            .orders-actions {
                width: 100%;
                justify-content: space-between;
            }
            
            .topbar {
                flex-direction: column;
                gap: 15px;
            }

            .search-box {
                width: 100%;
            }
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 侧边导航栏 -->
        <div class="sidebar">
            <div class="logo">
                <h1><i class="fas fa-shopping-bag"></i> <span>商城后台管理</span></h1>
            </div>
            <ul class="nav-links">
                <li><a href="#"><i class="fas fa-home"></i> <span>首页概览</span></a></li>
                <li><a href="#"><i class="fas fa-shopping-cart"></i> <span>商品管理</span></a></li>
                <li><a href="#" class="active"><i class="fas fa-list"></i> <span>订单管理</span></a></li>
                <li><a href="#"><i class="fas fa-users"></i> <span>用户管理</span></a></li>
                <li><a href="#"><i class="fas fa-chart-line"></i> <span>销售分析</span></a></li>
                <li><a href="#"><i class="fas fa-cog"></i> <span>系统设置</span></a></li>
            </ul>
        </div>

        <!-- 主内容区 -->
        <div class="main-content">
            <!-- 顶部导航 -->
            <div class="topbar">
                <div class="search-box">
                    <i class="fas fa-search"></i>
                    <input type="text" placeholder="搜索订单号或用户..." v-model="searchQuery">
                </div>
                <div class="user-actions">
                    <div class="notification">
                        <i class="fas fa-bell"></i>
                        <span class="badge">3</span>
                    </div>
                    <div class="user-profile">
                        <img src="https://randomuser.me/api/portraits/men/41.jpg" alt="管理员">
                    </div>
                </div>
            </div>

            <!-- 订单统计卡片 -->
            <div class="stats-row">
                <div class="stat-item">
                    <div class="stat-info">
                        <div class="stat-label">待付款订单</div>
                        <div class="stat-value">42</div>
                    </div>
                    <div class="stat-icon icon-pending">
                        <i class="fas fa-clock"></i>
                    </div>
                </div>
                
                <div class="stat-item">
                    <div class="stat-info">
                        <div class="stat-label">待发货订单</div>
                        <div class="stat-value">28</div>
                    </div>
                    <div class="stat-icon icon-paid">
                        <i class="fas fa-box-open"></i>
                    </div>
                </div>
                
                <div class="stat-item">
                    <div class="stat-info">
                        <div class="stat-label">已发货订单</div>
                        <div class="stat-value">156</div>
                    </div>
                    <div class="stat-icon icon-shipped">
                        <i class="fas fa-shipping-fast"></i>
                    </div>
                </div>
                
                <div class="stat-item">
                    <div class="stat-info">
                        <div class="stat-label">已完成订单</div>
                        <div class="stat-value">842</div>
                    </div>
                    <div class="stat-icon icon-completed">
                        <i class="fas fa-check-circle"></i>
                    </div>
                </div>
            </div>

            <!-- 订单管理区域 -->
            <div class="orders-container">
                <div class="orders-header">
                    <div class="orders-title">订单列表</div>
                    <div class="orders-actions">
                        <button class="btn btn-view"><i class="fas fa-file-export"></i> 导出数据</button>
                        <button class="btn btn-edit"><i class="fas fa-plus"></i> 添加订单</button>
                    </div>
                </div>
                
                <!-- 筛选区域 -->
                <div class="filter-section">
                    <div class="filter-group">
                        <label class="filter-label">订单状态</label>
                        <select class="filter-select" v-model="filterStatus">
                            <option value="">全部状态</option>
                            <option value="pending">待付款</option>
                            <option value="paid">已付款</option>
                            <option value="shipped">已发货</option>
                            <option value="completed">已完成</option>
                            <option value="cancelled">已取消</option>
                        </select>
                    </div>
                    
                    <div class="filter-group">
                        <label class="filter-label">下单时间</label>
                        <select class="filter-select" v-model="filterDate">
                            <option value="">全部时间</option>
                            <option value="today">今天</option>
                            <option value="week">本周</option>
                            <option value="month">本月</option>
                            <option value="quarter">本季度</option>
                        </select>
                    </div>
                    
                    <div class="filter-group">
                        <label class="filter-label">订单金额</label>
                        <select class="filter-select" v-model="filterAmount">
                            <option value="">全部金额</option>
                            <option value="0-100">0-100元</option>
                            <option value="100-500">100-500元</option>
                            <option value="500-2000">500-2000元</option>
                            <option value="2000+">2000元以上</option>
                        </select>
                    </div>
                    
                    <div class="filter-group">
                        <label class="filter-label">用户ID</label>
                        <input type="text" class="filter-input" placeholder="输入用户ID" v-model="filterUserId">
                    </div>
                </div>
                
                <!-- 订单表格 -->
                <table class="orders-table">
                    <thead>
                        <tr>
                            <th width="5%"><input type="checkbox"></th>
                            <th width="12%">订单号</th>
                            <th width="15%">用户信息</th>
                            <th width="15%">下单时间</th>
                            <th width="10%">金额</th>
                            <th width="15%">状态</th>
                            <th width="18%">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="order in filteredOrders" :key="order.id">
                            <td><input type="checkbox"></td>
                            <td class="order-id">#{{ order.id }}</td>
                            <td>
                                <div>{{ order.user.name }}</div>
                                <div style="font-size: 0.85rem; color: #b0b3b8;">ID: {{ order.user.id }}</div>
                            </td>
                            <td>{{ order.date }}</td>
                            <td>¥{{ order.amount.toFixed(2) }}</td>
                            <td>
                                <span :class="'status-badge status-' + order.status">{{ getStatusText(order.status) }}</span>
                            </td>
                            <td>
                                <div class="action-buttons">
                                    <button class="btn btn-view"><i class="fas fa-eye"></i> 查看</button>
                                    <button class="btn btn-edit" v-if="order.status !== 'completed' && order.status !== 'cancelled'">
                                        <i class="fas fa-edit"></i> 编辑
                                    </button>
                                    <button class="btn btn-cancel" v-if="order.status !== 'completed' && order.status !== 'cancelled'">
                                        <i class="fas fa-times"></i> 取消
                                    </button>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
                
                <!-- 分页 -->
                <div class="pagination">
                    <button class="page-btn" :class="{active: currentPage === 1}" @click="currentPage = 1">1</button>
                    <button class="page-btn" :class="{active: currentPage === 2}" @click="currentPage = 2">2</button>
                    <button class="page-btn" :class="{active: currentPage === 3}" @click="currentPage = 3">3</button>
                    <button class="page-btn">...</button>
                    <button class="page-btn" @click="currentPage = totalPages">{{ totalPages }}</button>
                    <button class="page-btn"><i class="fas fa-chevron-right"></i></button>
                </div>
            </div>
        </div>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                searchQuery: '',
                filterStatus: '',
                filterDate: '',
                filterAmount: '',
                filterUserId: '',
                currentPage: 1,
                totalPages: 8,
                orders: [
                    {
                        id: '20230615001',
                        user: { id: 'U10001', name: '张先生' },
                        date: '2023-06-15 14:30',
                        amount: 158.50,
                        status: 'paid'
                    },
                    {
                        id: '20230614002',
                        user: { id: 'U10045', name: '李女士' },
                        date: '2023-06-14 09:15',
                        amount: 2450.00,
                        status: 'shipped'
                    },
                    {
                        id: '20230613003',
                        user: { id: 'U10089', name: '王先生' },
                        date: '2023-06-13 18:42',
                        amount: 89.90,
                        status: 'pending'
                    },
                    {
                        id: '20230612004',
                        user: { id: 'U10123', name: '赵女士' },
                        date: '2023-06-12 11:05',
                        amount: 560.00,
                        status: 'completed'
                    },
                    {
                        id: '20230611005',
                        user: { id: 'U10167', name: '陈先生' },
                        date: '2023-06-11 16:20',
                        amount: 1200.00,
                        status: 'cancelled'
                    },
                    {
                        id: '20230610006',
                        user: { id: 'U10201', name: '刘女士' },
                        date: '2023-06-10 10:30',
                        amount: 345.50,
                        status: 'paid'
                    },
                    {
                        id: '20230609007',
                        user: { id: 'U10245', name: '杨先生' },
                        date: '2023-06-09 15:45',
                        amount: 780.00,
                        status: 'shipped'
                    },
                    {
                        id: '20230608008',
                        user: { id: 'U10289', name: '黄女士' },
                        date: '2023-06-08 19:20',
                        amount: 199.00,
                        status: 'pending'
                    }
                ]
            },
            computed: {
                filteredOrders() {
                    return this.orders.filter(order => {
                        const matchesSearch = this.searchQuery === '' || 
                            order.id.includes(this.searchQuery) || 
                            order.user.name.includes(this.searchQuery) ||
                            order.user.id.includes(this.searchQuery);
                        
                        const matchesStatus = this.filterStatus === '' || 
                            order.status === this.filterStatus;
                        
                        return matchesSearch && matchesStatus;
                    });
                }
            },
            methods: {
                getStatusText(status) {
                    const statusMap = {
                        'pending': '待付款',
                        'paid': '已付款',
                        'shipped': '已发货',
                        'completed': '已完成',
                        'cancelled': '已取消'
                    };
                    return statusMap[status] || '未知状态';
                }
            }
        });
    </script>
</body>
</html>